package com.qc31.monitorlib.uitls

import android.content.Context
import com.qc31.baselib.R
import com.qc31.comlib.entity.*

/** @Author Jasper @Time 2020/9/19 @Desc 视频相关帮助类 */
object DataUtil {

    private val videoResList = ArrayList<KeyValue>()


    fun getVideoRes(context: Context): MutableList<KeyValue> {
        if (videoResList.isEmpty()) {
            videoResList.add(KeyValue("0", context.getString(R.string.desc_video_res_one)))
            videoResList.add(KeyValue("1", context.getString(R.string.desc_video_res_two)))
            videoResList.add(KeyValue("2", context.getString(R.string.desc_video_res_three)))
            videoResList.add(KeyValue("3", context.getString(R.string.desc_video_res_four)))
        }
        return videoResList
    }

    private val videoStreamList = ArrayList<KeyValue>()
    fun getVideoStream(context: Context): MutableList<KeyValue> {
        if (videoStreamList.isEmpty()) {
            videoStreamList.add(
                KeyValue(
                    "0",
                    context.getString(R.string.desc_video_stream_all)
                )
            )
            videoStreamList.add(
                KeyValue(
                    "1",
                    context.getString(R.string.desc_video_main_stream)
                )
            )
            videoStreamList.add(
                KeyValue(
                    "2",
                    context.getString(R.string.desc_video_sub_stream)
                )
            )
        }
        return videoStreamList
    }

    private val videoStorageList = ArrayList<KeyValue>()
    fun getVideoStorage(context: Context): MutableList<KeyValue> {
        if (videoStorageList.isEmpty()) {
            videoStorageList.add(
                KeyValue(
                    "0",
                    context.getString(R.string.desc_video_storage_all)
                )
            )
            videoStorageList.add(
                KeyValue(
                    "1",
                    context.getString(R.string.desc_video_storage_one)
                )
            )
            videoStorageList.add(
                KeyValue(
                    "2",
                    context.getString(R.string.desc_video_storage_two)
                )
            )
        }
        return videoStorageList
    }

    /** 切换语言清除 */
    fun clearVideoList() {
        videoResList.clear()
        videoStreamList.clear()
        videoStorageList.clear()
    }


    val refreshTimes by lazy {
        mutableListOf(
            KeyValue("0", "10"),
            KeyValue("1", "15"),
            KeyValue("2", "20"),
            KeyValue("3", "25"),
            KeyValue("4", "30")
        )
    }


    //模拟量
    var analogEntity: ArrayList<SensorInfo>? = null

    private val cmdMap = HashMap<String, String>()

    fun setCmdToMap(cmdId: String, cmdName: String) {
        cmdMap[cmdId] = cmdName
    }

    fun getCmdName(cmdId: String?): String? = cmdMap[cmdId]

    private val logMap = HashMap<String, String>()

    fun setLogToMap(cmdId: String, cmdName: String) {
        logMap[cmdId] = cmdName
    }

    fun getLogName(cmdId: String?): String? = logMap[cmdId]
    private val regionMap = HashMap<String, String>()

    fun setRegionToMap(regionId: String, regionName: String) {
        regionMap[regionId] = regionName
    }

    fun getRegionName(regionId: String?): String? = regionMap[regionId]

    //历史轨迹
    var HistoryLine: HistoryLine? = null

    //照片详情列表
    var mPhotoInfo: ArrayList<PhotoInfo>? = null

    var logCmdEntity: ArrayList<CmdLog>? = null

    var alarmInfo: ArrayList<HistoryAlarm.TotalAlarms.InfoAlarms>? = null

    var alarmEntity: HistoryAlarm? = null

    var stopCar: StopStats? = null

}